﻿<%@ Page Language="C#" MasterPageFile="~/Areas/admin/Views/Shared/List.Master" Inherits="System.Web.Mvc.ViewPage<Longtop.Web.SaleWeb.Admin.Achievements.ListModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <%foreach (var d in Model.PagedList) {%>
    <thead>
        <tr>
            <th>
                <%=d.Text %>
            </th>
        </tr>
        <tr>
            <th>
                编号
            </th>
            <th>
                <%=Html.LabelFor(m=>m.User.UserName)%>
            </th>
            <th>
                <%=Html.LabelFor(m=>m.User.Achievements.First().CreateDT)%>
            </th>
            <%-- <th>
                产品类型
            </th>--%>
            <th>
                <%=Html.LabelFor(m=>m.User.Achievements.First().ProductName)%>
            </th>
            <th>
                <%=Html.LabelFor(m=>m.User.Achievements.First().Years)%>
            </th>
            <th>
                <%=Html.LabelFor(m=>m.User.Achievements.First().Amount)%>
            </th>
            <th>
                <%=Html.LabelFor(m=>m.User.Achievements.First().Reached)%>
            </th>
            <th>
                <%=Html.LabelFor(m=>m.User.Achievements.First().ReachedCount)%>
            </th>
            <th>
                <%=Html.LabelFor(m=>m.User.Achievements.First().NoReached)%>
            </th>
            <th>
                <%=Html.LabelFor(m=>m.User.Achievements.First().Price)%>
            </th>
            <th>
                <%=Html.LabelFor(m=>m.User.Achievements.First().Discount)%>
            </th>
            <th>
                <%=Html.LabelFor(m=>m.User.Achievements.First().SaleDiscount)%>
            </th>
            <th>
                <%=Html.LabelFor(m=>m.User.Achievements.First().SaleAchievement)%>
            </th>
            <th>
                操作
            </th>
        </tr>
    </thead>
    <tbody>
        <% if (d.Sales.All(s => s.Achievements.Count == 0)) { 
        %>
        <tr>
            <td colspan="20" align="center">
                暂无业绩数据
            </td>
        </tr>
        <%
            }
           foreach (var s in d.Sales) { %>
        <%--  <tr>
            <td>
                <%=s.UserName %>
            </td>
        </tr>--%>
        <% foreach (var item in s.Achievements) {%>
        <tr>
            <td>
                <%= item.Id %>
            </td>
            <td>
                <%= item.Sale.Name %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:yyyy/MM/dd}", item.CreateDT)) %>
            </td>
            <%-- <td>
                <%=item.Category.Text %>
            </td>--%>
            <td>
                <%=item.ProductName%>
            </td>
            <td>
                <%=item.Years %>
            </td>
            <td>
                <%=string.Format("{0:f2}",item.Amount)%>
            </td>
            <td>
                <%=string.Format("{0:f2}",item.Reached)%>
            </td>
            <td>
                <%=string.Format("{0:f2}",item.ReachedCount)%>
            </td>
            <td>
                <%=string.Format("{0:f2}",item.NoReached)%>
            </td>
            <td>
                <%=string.Format("{0:f2}",item.Price)%>
            </td>
            <td>
                <%=string.Format("{0:f2}",item.Discount.ToString("p0"))%>
            </td>
            <td>
                <%=string.Format("{0:f2}",item.SaleDiscount.ToString("p0"))%>
            </td>
            <td>
                <%=string.Format("{0:f2}",item.SaleAchievement)%>
            </td>
            <td>
                <%= Html.ActionLink("编辑", "Edit", new {  id=item.Id}) %>
                |<%= Html.ActionLink("删除", "Delete", new {  id=item.Id}) %>
            </td>
        </tr>
        <% } %>
        <% } %>
    </tbody>
    <% } %>
</asp:Content>
<asp:Content ID="Pager" ContentPlaceHolderID="Pager" runat="server">
    <%=Html.Pager(Model) %>
</asp:Content>
